Skip to content

Conversation

@danlapid
Copy link
Contributor

@danlapid danlapid commented Jan 11, 2026

When running opencode mcp auth in headless environments (SSH, devcontainers, WSL), the browser cannot be opened automatically. Previously this would fail with a cryptic "Something went wrong" error. Now the auth URL is displayed so users can manually open it in their local browser.

The fix catches three failure modes from the open package:

  • Synchronous exception: thrown when open() itself fails
  • "error" event: fires when the command doesn't exist (ENOENT)
  • "exit" event with non-zero code: fires when the command exists but fails (e.g., xdg-open can't connect to a display server)

What does this PR do?

Description above.

How did you verify your code works?

I tested this on my vscode devcontainer that was initially having this issue.

Fixes #7887

@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions
Copy link
Contributor

The following comment was made by an LLM, it may be inaccurate:

No duplicate PRs found

When running `opencode mcp auth` in headless environments (SSH,
devcontainers, WSL), the browser cannot be opened automatically.
Previously this would fail with a cryptic "Something went wrong" error.
Now the auth URL is displayed so users can manually open it in their
local browser.

The fix catches three failure modes from the `open` package:
- Synchronous exception: thrown when open() itself fails
- "error" event: fires when the command doesn't exist (ENOENT)
- "exit" event with non-zero code: fires when the command exists but
  fails (e.g., xdg-open can't connect to a display server)
@danlapid danlapid force-pushed the dlapid/fix_oauth_mcp branch from 5789e07 to 63c552e Compare January 16, 2026 00:10
@thdxr thdxr merged commit b572c68 into anomalyco:dev Jan 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

opencode mcp auth fails silently in remote/headless sessions (SSH, devcontainer)

2 participants